Ext.onReady(function(){
    Ext.QuickTips.init();
    
    //创建grid
    this.grid = new Ext.publics.ListGridPanel(this);
    
    //创建树
	var tree = getTree({
		id : "orgTree",
		border:false,
		root:root,
		hideCollapseTool:true
	},{tableName:"sys_unit",flds:"sfname",order:"sorder"},{
		parent:"sparent",
		root_filter:"sparent is null",
		node_name:"sname"
	},false);
	
	 //实现树的单击事件
	tree.on("click", function(node){
		pageparam.busiobj.cond = comboCondition(node.id);
		grid.searchData();
	});
	
	//布局
    var viewport = new Ext.Viewport({
        layout : 'border',
		items : [ {
			title : '<span class="commoncss">组织机构</span>',
			iconCls : 'chart_organisationIcon',
			tools : [ {
				id : 'refresh',
				handler : function() {
					tree.root.reload()
				}
			} ],
			collapsible : true,
			width : 210,
			minSize : 160,
			maxSize : 280,
			split : true,
			region : 'west',
			autoScroll : true,
			margins : '3 3 3 3',
			collapseMode:'mini',
			items : [ tree ]
		},{
			region : 'center',
			layout : 'fit',
			border : false,
			margins : '3 3 3 3',
			items : [ this.grid ]
		}]
    });
});